use fxhash::FxHashMap;
use mango_core::math::{Vec2, Vec3, Vec4};

pub mod vertex_attributes;
use crate::core::color::Color;

use self::reflection::ShaderReflection;
pub mod state;
pub mod reflection;
pub enum ConstValue {
    Number(f32),
    Boolean(bool),
}

pub struct DefineValue {
    name: String,
    value: ConstValue,
}

pub enum UniformValue {
    Number(f32),
    Vec2(Vec2),
    Vec3(Vec3),
    Vec4(Vec4),
    Color(Color),
    Float32Array(Vec<f32>),
}

pub enum UniformType {
    Number,
    Vec2,
    Vec3,
    Vec4,
    Color,
    Float32Array,
}

impl From<UniformType> for String {
    fn from(ty: UniformType) -> Self {
        match ty {
            UniformType::Number => "Number".to_owned(),
            UniformType::Vec2 => "Vec2".to_owned(),
            UniformType::Vec3 => "Vec3".to_owned(),
            UniformType::Vec4 => "Vec4".to_owned(),
            UniformType::Color => "Color".to_owned(),
            UniformType::Float32Array => "Float32Array".to_owned(),
        }
    }
}


pub enum Define {
    boolean(bool),
    number(f32),
    string(String)
}

pub type ShaderUniform = FxHashMap<String,String>;
pub type ShaderConst = FxHashMap<String,ConstValue>;
pub type ShaderDefines = FxHashMap<String,Define>;
pub struct ShaderValue {
   pub vs:String,
   pub fs:String,
   pub compute:String,
   pub vs_source:String,
   pub fs_source:String,
   pub compute_source:String,
   pub vs_shader:String,
   pub fs_shader:String,
   pub vs_module:wgpu::ShaderModule,
   pub fs_module:wgpu::ShaderModule,
   pub cs_module:wgpu::ShaderModule,
   pub shader_variant:String,
   pub uniforms:ShaderUniform,
   pub const_values:ShaderConst,
   pub defines:ShaderDefines,
   pub shader_reflection:Option<ShaderReflection>
}





